package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.TkdetailBean;
import com.lwj.liwanjia.impl.TkDetailView;
import com.lwj.liwanjia.model.TkDetailModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/23.
 */

public class TkDetailPresenter {
    private TkDetailModel tkDetailModel;
    private TkDetailView tkDetailView;

    public TkDetailPresenter(TkDetailView tkDetailView) {
        this.tkDetailView = tkDetailView;
        tkDetailModel = new TkDetailModel();
    }

    public void getTkDeatil(String token, String tradeId) {
        if (tkDetailView != null) {
            tkDetailModel.getTkDetail(token, tradeId, new Subscriber<TkdetailBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    tkDetailView.showError((Exception) e);
                }

                @Override
                public void onNext(TkdetailBean tkdetailBean) {
                    tkDetailView.getTkDetail(tkdetailBean);
                }
            });
        }
    }
}
